package com.example.plugin1.myplugin

import org.gradle.api.Plugin
import org.gradle.api.Project

class MyPlugin : Plugin<Project> {
    override fun apply(project: Project) {
        println("--------------- MyPlugin ------------------")
        val taskNames = project.gradle.startParameter.taskNames
        println("--------------- taskNames: $taskNames")
        try {
            val startTaskNames = project?.rootProject?.extensions?.extraProperties?.get("startTaskNames")
            println("--------------- startTaskNames: $startTaskNames")
        } catch (e: Exception) {
            project.logger.error("--------------- startTaskNames: $e")
        }
        try {
            val startTaskNames = project.parent?.rootProject?.extensions?.extraProperties?.get("startTaskNames")
            println("--------------- startTaskNames: $startTaskNames")
        } catch (e: Exception) {
            project.logger.error("--------------- startTaskNames: $e")
        }
    }
}